use super::CargoErr;


pub mod cargo_motor;
pub mod compr;
pub mod pick_motor;
pub mod scan_uart;
pub mod sensor;


pub fn cy_reset() -> Result<(), CargoErr> {
    compr::cy_to_top()?;
    compr::cy_to_extern()?;
    compr::cy_close();
    Ok(())
}

pub fn cargo_pick_motor_run(row_position: i32, col_position: u32) -> Result<(), CargoErr> {
    cy_reset()?;

    cargo_motor::run_with_async(row_position)?;
    pick_motor::run(col_position)?;
    cargo_motor::wait_async_finish()?;
    Ok(())
}

pub unsafe fn init() {
    cargo_motor::init();
    compr::init();
    pick_motor::init();
    scan_uart::init();
    sensor::init();
}









